package cc.togetherit.jcrawler.fetch;

import java.util.HashMap;
import java.util.Map;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
@XmlType(name = "fetchConfig", propOrder = {"type", "fetchRegex", "parseRegex"})
public class FetchConfig {
    private int type;
    @XmlElement(required = true)
    private Map<String,Integer> fetchRegex;
    @XmlElement(required = true)
    private Map<String,Integer> parseRegex;

    public Map<String, Integer> getFetchRegex() {
        return fetchRegex;
    }

    public void setFetchRegex(Map<String, Integer> fetchRegex) {
        this.fetchRegex = fetchRegex;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    
    public Map<String, Integer> getParseRegex() {
        return parseRegex;
    }

    public void setParseRegex(Map<String, Integer> parseRegex) {
        this.parseRegex = parseRegex;
    }

    @Override
    public String toString() {
        return "FetchConfig [type=" + type + ", fetchRegex=" + fetchRegex + "]";
    }
    
    public void defaultConfig(){
        fetchRegex = new HashMap<String,Integer>();
        fetchRegex.put("(.*)", type);
    };
    
}
